class Emp {
  late String ename;
  late int age;

  Emp(this.ename, this.age);

  printInfo(){
    print('ename:${this.ename}, age:${this.age}');
  }
}

// class A { }

//程序员“是一个”员工，应该继承员工的所有成员 ——  Dart采用“单继承”策略，每个类有且只能有一个父类
class Coder extends Emp {
  late double salary;
  /*
  Coder(String ename, int age, double salary){
    //super(ename, age);    //编译错误
    //super.ename = ename;
    //super.age = age;
    this.salary = salary;
  }
  */
  Coder(super.ename, super.age, this.salary);   //注意此处子类构造方法的编写

  @override
  printInfo() {
    print('ename:${this.ename}, age:${this.age}, salary:${this.salary}');
  }
}

main(){
  Coder e1 = Coder('Tom', 20, 80000);
  Emp   e2 = Coder('Mary', 30, 100000);

  e1.printInfo();
  e2.printInfo();
}